//
//  GMFirstCollectionViewCell.m
//  Teecloud
//
//  Created by 小熊 on 2018/6/21.
//  Copyright © 2018年 小熊. All rights reserved.
//

#import "GMFirstCollectionViewCell.h"
@interface GMFirstCollectionViewCell()
@property (weak, nonatomic) IBOutlet UIImageView *img;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *countlab;


@end
@implementation GMFirstCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)setGroModel:(GMHeaderModel *)groModel{
    _groModel = groModel;
    self.img.image = [UIImage imageNamed:groModel.imgUrl];
//    NSString *str =[NSString stringWithFormat:@"%@%@",groModel.titName,groModel.count];
    self.name.text =groModel.titName;
    if (kIsEmptyString(groModel.MyNewCount)) {
        self.countlab.text = groModel.count;
    }else{
        if ([groModel.MyNewCount isEqualToString:@"0"]) {
            self.countlab.text = groModel.count;
        }else{
             self.countlab.attributedText = [self String:groModel.count RangeString:groModel.MyNewCount];
        }
    }
}


/**设置价钱的大小字体*/
-(NSMutableAttributedString *)String:(NSString *)String RangeString:(NSString *)RangeString{
    NSMutableAttributedString *hintString=[[NSMutableAttributedString alloc]initWithString:String];
    //获取要调整颜色的文字位置,调整颜色
    NSRange range1=[[hintString string]rangeOfString:RangeString];
    [hintString addAttributes:@{NSForegroundColorAttributeName:[UIColor colorWithHexString:@"007AFF"],NSFontAttributeName:[UIFont systemFontOfSize:12]} range:range1];
    return hintString;
}
@end
